home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / quantum.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  2KB  |  122 lines

  1. #include "driver.h"
  2. #include "vidhrdw/avgdvg.h"
  3.  
  4.  
  5.  
  6.  
  7. /*** quantum_interrupt
  8. *
  9. * Purpose: do an interrupt - so many times per raster frame
  10. *
  11. * Returns: 0
  12. *
  13. * History: 11/19/97 PF Created
  14. *
  15. **************************/
  16. int quantum_interrupt(void)
  17. {
  18.     return 1; /* ipl0' == ivector 1 */
  19. }
  20.  
  21. /*** quantum_switches_r
  22. *
  23. * Purpose: read switches input, which sneaks the VHALT' in
  24. *
  25. * Returns: byte
  26. *
  27. * History: 11/20/97 PF Created
  28. *
  29. **************************/
  30. READ_HANDLER( quantum_switches_r )
  31. {
  32.     return (input_port_0_r(0) |
  33.         (avgdvg_done() ? 1 : 0));
  34. }
  35.  
  36.  
  37.  
  38. WRITE_HANDLER( quantum_led_w )
  39. {
  40.     /* bits 0 and 1 are coin counters */
  41.     coin_counter_w(0,data & 2);
  42.     coin_counter_w(1,data & 1);
  43.  
  44.     /* bits 4 and 5 are LED controls */
  45.     osd_led_w(0,(data & 0x10) >> 4);
  46.     osd_led_w(1,(data & 0x20) >> 5);
  47.  
  48.     /* other bits unknown */
  49. }
  50.  
  51.  
  52.  
  53. /*** quantum_snd_read, quantum_snd_write
  54. *
  55. * Purpose: read and write POKEY chips -
  56. *    need to do translation, so we don't directly map it
  57. *
  58. * Returns: register value, for read
  59. *
  60. * History: 11/19/97 PF Created
  61. *
  62. **************************/
  63. WRITE_HANDLER( quantum_snd_w )
  64. {
  65.     if (offset & 0x20) /* A5 selects chip */
  66.         pokey2_w((offset >> 1) % 0x10,data);
  67.     else
  68.         pokey1_w((offset >> 1) % 0x10,data);
  69. }
  70.  
  71. READ_HANDLER( quantum_snd_r )
  72. {
  73.     if (offset & 0x20)
  74.         return pokey2_r((offset >> 1) % 0x10);
  75.     else
  76.         return pokey1_r((offset >> 1) % 0x10);
  77. }
  78.  
  79.  
  80. /*** quantum_trackball
  81. *
  82. * Purpose: read trackball port.  So far, attempting theory:
  83. *    D0-D3 - vert movement delta
  84. *    D4-D7 - horz movement delta
  85. *
  86. *    if wrong, will need to pull out my 74* logic reference
  87. *
  88. * Returns: 8 bit value
  89. *
  90. * History: 11/19/97 PF Created
  91. *
  92. **************************/
  93. READ_HANDLER( quantum_trackball_r )
  94. {
  95.     int x, y;
  96.  
  97.     x = input_port_4_r (offset);
  98.     y = input_port_3_r (offset);
  99.  
  100.     return (x << 4) + y;
  101. }
  102.  
  103.  
  104. /*** quantum_input_1_r, quantum_input_2_r
  105. *
  106. * Purpose: POKEY input switches read
  107. *
  108. * Returns: in the high bit the appropriate switch value
  109. *
  110. * History: 12/2/97 ASG Created
  111. *
  112. **************************/
  113. READ_HANDLER( quantum_input_1_r )
  114. {
  115.     return (input_port_1_r (0) << (7 - (offset - POT0_C))) & 0x80;
  116. }
  117.  
  118. READ_HANDLER( quantum_input_2_r )
  119. {
  120.     return (input_port_2_r (0) << (7 - (offset - POT0_C))) & 0x80;
  121. }
  122.